package com.train.webadmin.app.model;

import com.baomidou.mybatisplus.annotation.*;
import com.train.common.core.annotation.*;
import lombok.Data;

import java.util.Map;

/**
 * 赋分详情实体对象。
 *
 * @author xulei
 * @date 2025-03-07
 */
@Data
@TableName(value = "score_detail")
public class ScoreDetail {

    /**
     * id。
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 科目id。
     */
    @TableField(value = "subject_id")
    private Long subjectId;

    /**
     * 总分数据id。
     */
    @TableField(value = "class_student_id")
    private Long classStudentId;

    /**
     * 学生id。
     */
    @TableField(value = "student_id")
    private Long studentId;

    /**
     * 分数。
     */
    @TableField(value = "score")
    private Double score;

    /**
     * score 范围过滤起始值(>=)。
     */
    @TableField(exist = false)
    private Double scoreStart;

    /**
     * score 范围过滤结束值(<=)。
     */
    @TableField(exist = false)
    private Double scoreEnd;

    @RelationOneToOne(
            masterIdField = "subjectId",
            slaveModelClass = SubjectInfo.class,
            slaveIdField = "id")
    @TableField(exist = false)
    private SubjectInfo subjectInfo;

    @RelationOneToOne(
            masterIdField = "studentId",
            slaveModelClass = StudentInfo.class,
            slaveIdField = "id")
    @TableField(exist = false)
    private StudentInfo studentInfo;

    @RelationOneToOne(
            masterIdField = "classStudentId",
            slaveModelClass = ClassStudent.class,
            slaveIdField = "id")
    @TableField(exist = false)
    private ClassStudent classStudent;

    @RelationDict(
            masterIdField = "studentId",
            equalOneToOneRelationField = "studentInfo",
            slaveModelClass = StudentInfo.class,
            slaveIdField = "id",
            slaveNameField = "name")
    @TableField(exist = false)
    private Map<String, Object> studentIdDictMap;

    @TableField(exist = false)
    private String subjectName;
}
